<?php

namespace Home\Controller;

use Think\Controller;

class IndexController extends Controller {

    public function index() {
        $pluginmodel = M('plugins');
        $pluginmodel->limit(0);
        $plugins = $pluginmodel->select();
        $this->assign('plugins', $plugins);
        $pagesize = 20;
        $count = $pluginmodel->count();
        import('ORG.Util.Page');// 导入分页类
        $Page = new \Org\Util\Page($count, 25); // 实例化分页类 传入总记录数和每页显示的记录数
        $show = $Page->show(); // 分页显示输出
        $tagsmodel = M('tags');
        $tags = $tagsmodel->select();
        $this->assign('tags', $tags);
        $curtype = '-1';
        if (isset($_GET['type'])) {
            $type = $_GET['type'];
            if ($type == '0' || $type == '1') {
                $curtype = $type;
            }
        }
        $this->assign('curtype', $curtype);
        $curtag = 'all';
        if (isset($_GET['tag'])) {
            $curtag = $_GET['tag'];
        }
        $this->assign('curtype', $curtype);
        $this->assign('curtag', $curtag);
        $this->assign('page',$show);
        $pages = $this->show();
    }

}
